import org.junit.Test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.Date;

public class DateCaculateTest {



  @Test
  public void test1() throws ParseException {

    LocalDate localDate = LocalDate.now();

    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    Date date = df.parse("2018-05-24");

//    LocalDate localDate1 = LocalDate.of(localDate.getDayOfYear(),localDate.getMonth(),localDate .getYear());
//    Date date = new Date();
//    System.out.println("current date: " + date);

// Date -> LocalDateTime
    LocalDate localDate1 = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();

    System.out.println(localDate);
    System.out.println(localDate1);

    long days = localDate1.until(localDate, ChronoUnit.DAYS);

    System.out.println(111);
    System.out.println(days);
  }
}
